package com.fcscs.ecms.dao.hibernate;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.fcscs.core.dao.ConnectionManager;
import com.fcscs.core.domain.BaseEntity.DBLoc;
import com.fcscs.ecms.dao.ECMSEntertainmentDynamicFieldDao;
import com.fcscs.ecms.domain.MdlEntertainmentDynamicField;

/**
 * @author pvttinh
 * 
 */

@SuppressWarnings("unchecked")
@Repository("entertainmentDynamicFieldDao")
public class ECMSEntertainmentDynamicFieldDaoHibernate implements ECMSEntertainmentDynamicFieldDao {

	@Autowired
	private ConnectionManager connMgr;

	@Override
	public MdlEntertainmentDynamicField get(int id) throws Exception {
		// TODO Auto-generated method stub
		MdlEntertainmentDynamicField entertainmentDynamicField= null;
		try{
			entertainmentDynamicField = (MdlEntertainmentDynamicField) this.connMgr.getCurrentSession(DBLoc.GUEST).get(MdlEntertainmentDynamicField.class, id);
			if(null == entertainmentDynamicField){
				throw new Exception("ENTERTAINMENT DYNAMIC FIELD NOT EXIST");
			}
		}
		catch (Exception e) {
			// TODO: handle exception
			throw new Exception("EntertainmentDynamicField.DAO.get() - " + e.getMessage());
		}
		
		return entertainmentDynamicField;
	}
}
